package com.atguigu.springcloud.filter;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @auther clj
 * @create 2020-02-19 15:20
 */
@Configuration
public class ApplicationContextConfig {
    @Bean
    // 加上这个注解后就就使用的负载均衡的方式(默认是轮询的方式)
    @LoadBalanced
    public RestTemplate getRestTemplate() {
        return new RestTemplate();
    }
}